package factory_model;

public class BuyPet {
	public static void main(String[] args) {
		Pet mypet=PetStore.getpeg(PetStore.P1);
		mypet.mypet();
	}

}
class PetStore{
	final static int P1=1;
	final static int P2=2;
	final static int P3=3;
	static public Pet getpeg(int num){
		switch(num){
		case P1:return new Dog();
		case P2:return new Tiger();
		case P3:return new Lion();
		default :return null;
		}
	}
}
class Dog implements Pet{

	@Override
	public void mypet() {

		System.out.println("Dog");
	}
	
} 
class Tiger implements Pet{
	
	@Override
	public void mypet() {
		
		System.out.println("Tiger");
	}
	
}
class Lion implements Pet{
	
	@Override
	public void mypet() {
		
		System.out.println("Lion");
	}
	
}
interface Pet{
	void mypet();
}